import { ResponseUtilService } from '@app/response-util';
import { Body, Controller, ParseIntPipe, Post, Req } from '@nestjs/common';
import { DtoPipe } from '../../pipe/dto/dto.pipe';
import PageDto from './dto/page.dto';
import { WaterTestService } from './water-test.service';

@Controller('waterTest')
export class WaterTestController {
    constructor(
        private readonly service:WaterTestService
    ){}


    @Post('page')
    async page(@Body(new DtoPipe({skipMissingProperties : true})) dto:PageDto, @Req() req) {
        const result = await this.service.page(dto)

        return ResponseUtilService.successRes(result)

    }

    @Post('data')
    async testData(@Body('id', ParseIntPipe) id:number, @Req() req) {
        const data = await this.service.testData(id)

        return ResponseUtilService.successRes(data)

    }
}
